// 设置cookie
export function setCookie (cname:string, cvalue:string, exdays: number) {
    if (exdays) {
      let d:any = new Date();
      let val = JSON.stringify(cvalue)
      d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
      let expires = "expires=" + d.toGMTString();
      document.cookie = cname + "=" + val + "; " + expires;
    } else {
      document.cookie = cname + "=" + cvalue + "; ";
    }
   
  }
  
  // 获取cookie
  export function getCookie (cname:string) {
    let name = cname + "=";
    let ca = document.cookie.split(';');
    for (let i = 0; i < ca.length; i++) {
      let c = ca[i].trim();
      if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
    }
    return "";
  }




        
        

        
